/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.vfi.be;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "VFI_PAGO_CREDITO")
@NamedQueries({@NamedQuery(name = "PagoCredito.findAll", query = "SELECT p FROM PagoCredito p"), @NamedQuery(name = "PagoCredito.findByIdPagoCredito", query = "SELECT p FROM PagoCredito p WHERE p.idPagoCredito = :idPagoCredito"), @NamedQuery(name = "PagoCredito.findByFidSacCuotaCredito", query = "SELECT p FROM PagoCredito p WHERE p.fidSacCuotaCredito = :fidSacCuotaCredito"), @NamedQuery(name = "PagoCredito.findByMonto", query = "SELECT p FROM PagoCredito p WHERE p.monto = :monto"), @NamedQuery(name = "PagoCredito.findByMora", query = "SELECT p FROM PagoCredito p WHERE p.mora = :mora")})
public class PagoCredito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_PAGO_CREDITO", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idPagoCredito;
    @Basic(optional = false)
    @Column(name = "FID_SAC_CUOTA_CREDITO", nullable = false)
    private long fidSacCuotaCredito;
    @Column(name = "MONTO", precision = 18, scale = 2)
    private BigDecimal monto;
    @Column(name = "MORA", precision = 18, scale = 2)
    private BigDecimal mora;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "pagoCredito", fetch = FetchType.LAZY)
    private TranFinanciera tranFinanciera;

    public PagoCredito() {
    }

    public PagoCredito(Long idPagoCredito) {
        this.idPagoCredito = idPagoCredito;
    }

    public PagoCredito(Long idPagoCredito, long fidSacCuotaCredito) {
        this.idPagoCredito = idPagoCredito;
        this.fidSacCuotaCredito = fidSacCuotaCredito;
    }

    public Long getIdPagoCredito() {
        return idPagoCredito;
    }

    public void setIdPagoCredito(Long idPagoCredito) {
        this.idPagoCredito = idPagoCredito;
    }

    public long getFidSacCuotaCredito() {
        return fidSacCuotaCredito;
    }

    public void setFidSacCuotaCredito(long fidSacCuotaCredito) {
        this.fidSacCuotaCredito = fidSacCuotaCredito;
    }

    public BigDecimal getMonto() {
        return monto;
    }

    public void setMonto(BigDecimal monto) {
        this.monto = monto;
    }

    public BigDecimal getMora() {
        return mora;
    }

    public void setMora(BigDecimal mora) {
        this.mora = mora;
    }

    public TranFinanciera getTranFinanciera() {
        return tranFinanciera;
    }

    public void setTranFinanciera(TranFinanciera tranFinanciera) {
        this.tranFinanciera = tranFinanciera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPagoCredito != null ? idPagoCredito.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PagoCredito)) {
            return false;
        }
        PagoCredito other = (PagoCredito) object;
        if ((this.idPagoCredito == null && other.idPagoCredito != null) || (this.idPagoCredito != null && !this.idPagoCredito.equals(other.idPagoCredito))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vfi.be.PagoCredito[idPagoCredito=" + idPagoCredito + "]";
    }

}
